package com.webex.ta.hydra.gui.action;

import com.webex.ta.hydra.core.PropertyManager;
import com.webex.ta.hydra.gui.GuiPackage;

import java.awt.event.ActionEvent;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by Cisco WebEx.
 * User: vegaz
 * Date: 2010-9-15
 * Time: 16:21:40
 */
public class ExitAction implements ActionHandler {
    private static Set<String> commands = new HashSet<String>();

    static {
        commands.add(ActionNames.EXIT);
    }

    public Set<String> getActionNames() {
        return commands;
    }

    public void doAction(ActionEvent e) {
        if (GuiPackage.getInstance().getHydraTable() != null)
            GuiPackage.getInstance().getHydraTable().stopEdit();
//        if (ScriptDirtyChecker.isDirty()) {
//            if (CloseAction.performAction(e) != JOptionPane.YES_OPTION) {
//                return;
//            }
//        }

        PropertyManager.getInstance().saveUserProps();
        System.exit(0);
    }
}
